package cn.hxzy.icon.zyinon.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * (Icon)实体类
 *
 * @author makejava
 * @since 2020-08-13 10:06:51
 */
@Table
@Entity
@Data
public class Icon implements Serializable {
    private static final long serialVersionUID = 113635969754982706L;
    /**
     * 菜单id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    /**
     * 菜单名字
     */
    private String name;
    @CreationTimestamp//每次对象插入数据库就会有创建时间
    @Column(updatable = false)//插入数据库之后此字段不让修改
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")//转成json字符串时的格式和时区
    private Date createTime;

    @UpdateTimestamp
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;
    /**
     * 顺序：越大越靠前
     */
    private Integer orders;
    /**
     * 图片字节码
     */
    private byte[] imgByte;

    @ManyToOne
    @JoinColumn(name = "group_id")
    private IconGroup group;



}
